class clusters::login inherits clusters{


 
  file {"/etc/profile.d/login.sh":
    mode       =>  '755',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/env/login.sh",
  }
  file {"/etc/profile.d/login.csh":
    mode       =>  '755',
    owner      =>  'root',
    group      =>  'root',
    source     =>  "puppet:///modules/${module_name}/env/login.csh",
  }
  if $facts['os']['release']['major'] < '8' {
    file {"/etc/motd-local":
      mode       =>  '0644',
      owner      =>  'root',
      group      =>  'root',
      content    =>   template("${module_name}/motd-local.erb"),
    }
    file{"/root/bin/checkssh.sh":
      mode       =>  '755',
      owner      =>  'root',
      group      =>  'root',
      source     =>  "puppet:///modules/${module_name}/checkssh.sh",
      require    =>  File['/root/bin'],
    }
    file{"/etc/hosts.allow":
      mode       =>  '644',
      owner      =>  'root',
      group      =>  'root',
      source     =>  "puppet:///modules/${module_name}/hosts.allow",
    }
    file {["/var/log/pbs","/var/log/pbs/users"]:
      mode       =>  '777',
      ensure     =>  "directory",
    }
  }
  else{
    file {"/etc/motd":
      mode       =>  '0644',
      owner      =>  'root',
      group      =>  'root',
      content    =>   template("${module_name}/motd-local.erb"),
    }
   # alma 9 login node with same hostkey for loadbalance
   file { "/etc/ssh/ssh_host_ecdsa_key":
     mode       =>  '0640',
     owner      =>  'root',
     group      =>  'ssh_keys',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_ecdsa_key",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_ecdsa_key.pub":
     mode       =>  '0644',
     owner      =>  'root',
     group      =>  'root',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_ecdsa_key.pub",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_ed25519_key":
     mode       =>  '0640',
     owner      =>  'root',
     group      =>  'ssh_keys',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_ed25519_key",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_ed25519_key.pub":
     mode       =>  '0644',
     owner      =>  'root',
     group      =>  'root',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_ed25519_key.pub",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_dsa_key":
     mode       =>  '0600',
     owner      =>  'root',
     group      =>  'root',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_dsa_key",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_dsa_key.pub":
     mode       =>  '0644',
     owner      =>  'root',
     group      =>  'root',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_dsa_key.pub",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_rsa_key":
     mode       =>  '0600',
     owner      =>  'root',
     group      =>  'root',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_rsa_key",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_rsa_key.pub":
     mode       =>  '0644',
     owner      =>  'root',
     group      =>  'root',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_rsa_key.pub",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_key":
     mode       =>  '0600',
     owner      =>  'root',
     group      =>  'root',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_key",
     notify => Service['sshd'],
   }
   file { "/etc/ssh/ssh_host_key.pub":
     mode       =>  '0644',
     owner      =>  'root',
     group      =>  'root',
     source     =>  "puppet:///modules/${module_name}/ssh9/ssh_host_key.pub",
     notify => Service['sshd'],
   }


  }

  file {"/usr/bin/kpasswd":
    ensure   => link,
    target   => "/afs/ihep.ac.cn/soft/common/sysgroup/passwdkrb5_for_user.sh",
    force    => true,
  }
  file {"/usr/bin/kpasswd_krb5":
    ensure   => link,
    target   => "/afs/ihep.ac.cn/soft/common/sysgroup/kpasswd_krb5",
    force    => true,
  }
  file {"/usr/bin/passwd":
    ensure   => link,
    target   => "/afs/ihep.ac.cn/soft/common/sysgroup/passwdkrb5_for_user.sh",
    force    => true,
  }


  # For limit resourc in crond service
  if $allowlimits {
    file { "/etc/systemd/system/crond.service.d":
      ensure =>  "directory",
      mode   => '0755',
      owner  => 'root',
      group  => 'root',
    } ->
    file { "/etc/systemd/system/crond.service.d/override.conf":
      mode   => '0644',
      owner  => 'root',
      group  => 'root',
      notify => Service['crond'],
      content => template("${module_name}/crond_override.conf.erb"),
      #source =>   "puppet:///modules/${module_name}/crond_override.conf",
    }
  }


  package {"loadbalance-client":
    ensure    => 'installed',
    require   => Yumrepo['site'],
  }
  
  case $operatingsystemmajrelease {
  '6':{
    cron{'changeTGTown':
      command => "/afs/ihep.ac.cn/soft/common/changeTGTown.sh",
      user    => 'root',
      minute  => '*/1',
    }
  }
  }

case $operatingsystemmajrelease {
'7': {
    file { "/usr/lib64/nagios/plugins/SiteJobMon":
      mode       =>  '0755',
      owner      =>  'huqb',
      group      =>  'u07',
      recurse    =>   true,
      ensure     =>   directory,
      source     =>  "puppet:///modules/${module_name}/SiteJobMon",
      require   => Yumrepo['site'],
    }

  }
 
}
 
}
